<?php echo $this->Form->create("User"); ?>
 <fieldset style="overflow: hidden;border: 1px solid #cccccc;border-radius: 5px;padding: 10px;">
    <?php echo $this->Form->input('id', array('type' => 'hidden')); ?>
    <div class="input-content">
        <div class="input ">
            <label for="last-name">Username<span>*</span></label>
            <?php echo $this->Form->input('user', array('class' => 'placeholder', 'placeholder' => '', 'label' => false, 'div' => false, 'type' => 'text')); ?>
            <div class="error-message" id="firstNameError"></div>
        </div>
        <div class="input ">      
        <label for="password">Password<span>*</span></label>
        <?php echo $this->Form->input('password', array('class' => 'placeholder', 'placeholder' => '', 'label' => false, 'div' => false)); ?>
        <div class="error-message" id="pwdError"></div>

    </div>
    <div class="input ">

        <label for="email">Email</label>
        <?php echo $this->Form->input('email', array('class' => 'placeholder', 'placeholder' => '', 'label' => false, 'div' => false)); ?>
        <div class="error-message" id="emailIDError"></div>

    </div>

    <div class="input ">
        <label for="last-name">Mr Code</label>
        <?php
        echo $this->Form->input('mr_code', array(
            'type' => 'select',
            'options' => $mrCode,
            'empty' => 'please select a one',
            'label' => false,
            'div' => false,
                )
        );
        ?>
        <div class="error-message" id="lastNameError"></div>
    </div>
    </div>
    <div class="submit">
        <?php echo $this->Form->submit("", array('class' => 'save', 'id' => 'btnSave')); ?>
     <!-- <input type="submit" id="btnSave" value="" class="save"> -->
        <a href="javascript:resetForm()" id="resetForm" class="reset">Reset</a>
    </div>
</fieldset>
<?php echo $this->Form->end(); ?>
 <script>
    $("#btnSave").click(function(){
            var  validateUser   = new validate("UserUser","firstNameError","This field is not empty.");
                        // alert(validateEmailID.notEmpty());
            var  validatePassword        = new validate("UserPassword",'pwdError',"This field is not empty.");
            var  result     = validateUser.notEmpty();

            var  result2    = validatePassword.notEmpty();
            var result3 =true;

            var result6 = false;
            if(result && $("#UserEmail").val())
            {
                var  validateEmailID     = new validate("UserEmail","emailIDError","Enter invalid email.");
                result3    = validateEmailID.email();
            }
            var rt = result2 && result3 && result;
            return rt;
        });
     function resetForm()
     {
        window.location.reload();
     }
    </script>     